#pragma once
#include "trace.h"
class CNode
{
public:
	CNode(const NODE_INDEX nNodeIndex);
	virtual~CNode(void);
	
	inline NODE_INDEX GetNodeIndex()const
	{
		return m_nNodeIndex;
	};
	bool AddTimer(const TIMER_TYPE dwType, const DWORD dwDelay, const DWORD dwPeriod);
	bool AddAlarm(TIMER_TYPE dwType, DWORD dwDelay);
	bool KillTimer(TIMER_TYPE dwType);
	virtual void OnTimer(const TIMER_TYPE dwType);
	virtual void OnJoin(void);
	virtual void OnLeave(void);
protected:
	set<TIMER_TYPE> m_cTimerSet;
	void Log(int nLevel,const char *pFormat,...);
	static CFormativeTrace s_cFormatTracer;
	NODE_INDEX m_nNodeIndex;
	MSEC m_nJoinTime,m_nLeaveTime;

};
